import { Model } from 'dva';
import Service from '@/public/http/services';
export default {
    namespace: 'financeAndLogister',
    state: {
        list: [],
        total: 0,
        selectlist: []
    },
    effects: {
        *fetchList({ payload }, { put, call }) {
            const result = yield call(Service.queryTreasureBox, payload);
            const result2 = yield call(Service.queryboxselect, {mtype:6});
            var j:any;
            var json={};
            for(j in result2) {
              json[result2[j].moduleId] = result2[j].moduleName;
            }
            yield put({ type: 'setList', payload: [result,json] });
        },
    },
    reducers: {
        setList(state, { payload: [{ list, pageCount },r2] } : any) {
            state.list = list;
            state.total = pageCount;
            state.selectlist = r2
            return state;
        }
    },
} as Model

